package edu.rutgers.moko.data.util;

import java.util.Arrays;
import java.util.List;

public enum Flag {
	ALLOW("Allow", true),
	DENY("Deny", false);
	
	private final String title;
	private final Boolean isVisible; 
	
	private Flag(String title, Boolean isVisible){
		this.title = title;
		this.isVisible = isVisible;
	}
	
	public String title(){
		return title;
	}
	
	public Boolean isVisible(){
		return isVisible;
	}
	
	public static List<Flag> valuesAsList(){
		return Arrays.asList(Flag.values());
	}

	
	public static Flag getByTitle(String field){
		Flag result = Flag.ALLOW;
		if("deny".equals(field.toLowerCase())){
			result = Flag.DENY;
		}
		return result;
	}
}
